#ifndef PARSERMOVIE_H
#define PARSERMOVIE_H


//----------------------------------------------------------------------------//
// I N C L U D E   Q T                                                        //
//----------------------------------------------------------------------------//
#include <QObject>


//----------------------------------------------------------------------------//
// I N C L U D E   P R O J E C T                                              //
//----------------------------------------------------------------------------//
#include "movie.h"
#include "parsertheater.h"
#include "theater.h"
#include "wget.h"


//----------------------------------------------------------------------------//
// M A C R O S                                                                //
//----------------------------------------------------------------------------//


//----------------------------------------------------------------------------//
// T Y P E S   &   D E F I N I T I O N S                                      //
//----------------------------------------------------------------------------//
typedef enum
{
  PARSER_MOVIE_OK,
  PARSER_MOVIE_NOK,
  PARSER_MOVIE_TIMEOUT
} ParserMovieStatus_t;


//----------------------------------------------------------------------------//
// C L A S S   D E C L A R A T I O N                                          //
//----------------------------------------------------------------------------//
class ParserMovie : public QObject
{
    Q_OBJECT
  public:
    //------------------------------------------------------------------------//
    // C O N T R U C T O R S                                                  //
    //------------------------------------------------------------------------//
    explicit ParserMovie(QObject *parent = 0);


    //------------------------------------------------------------------------//
    // P U B L I C   M E T H O D S   D E C L A R A T I O N                    //
    //------------------------------------------------------------------------//
    ParserMovieStatus_t requestParseMovies(ParserTheater& parseTheater);


    //------------------------------------------------------------------------//
    // P U B L I C   A T T R I B U T E S   D E C L A R A T I O N              //
    //------------------------------------------------------------------------//
    QList<Movie *> Movies;


  signals:
    //------------------------------------------------------------------------//
    // S I G N A L S                                                          //
    //------------------------------------------------------------------------//
    void moviesCompute(void);


  private:
    //------------------------------------------------------------------------//
    // P R I V A T E   M E T H O D S   D E C L A R A T I O N                  //
    //------------------------------------------------------------------------//
    ParserMovieStatus_t parseMovies(Wget&    network,
                                    Theater* thtr);
    ParserMovieStatus_t parseMovie(QStringList page,
                                   Theater*&   thtr);
    void getDataIMDb(QString  title,
                     QString& url,
                     QString& rate);
    void getDataAllocine(QString  title,
                         QString& url,
                         QString& rate,
                         QString& poster);
    void addMovie(QString& title,
                  QString& duration);
    void addSeanceMovie(QString&    title,
                        Theater*&   thtr,
                        QString&    date,
                        MovieDub_t& dub,
                        Movie3D_t&  threed,
                        QString&    time);


    //------------------------------------------------------------------------//
    // P R I V A T E   A T T R I B U T E S   D E C L A R A T I O N            //
    //------------------------------------------------------------------------//
    // timeout in milliseconds
    int Timeout;
};


#endif // PARSERMOVIE_H
